package com.study.forumsystemproject.model;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.util.StringUtils;

/**
 * program: forum-system-project
 * <p>
 * description: 登录类
 * <p>
 * author: xiaoxie
 * <p>
 * create: 2024-08-15 09:29
 **/
@Data
@Schema(name = "登录信息类", description = "用于登录的相关信息")
public class LoginInfo {
    private Long id;
    @Schema(description = "用户名",  example = "user123")
    private String username;
    @Schema(description = "密码",  example = "p@ssw0rd")
    private String password;
    private Integer state;
    @Schema(description = "验证码",  example = "1234")
    private String code;
    @Schema(description = "时间")
    private Long date;

    /**
     * 检查登录信息是否完整
     * @return 如果用户名、密码和验证码都不为空，则返回true
     */
    public Boolean checkNull(){
        return StringUtils.hasLength(username) && StringUtils.hasLength(password) && StringUtils.hasLength(code);
    }
}
